package cn.lyh.gulimall.product.service;

import cn.lyh.gulimall.product.vo.AttrRelationVo;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.awt.event.ItemEvent;
import java.util.List;
import java.util.stream.Collectors;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import cn.lyh.gulimall.product.entity.PmsAttrAttrgroupRelation;
import cn.lyh.gulimall.product.dao.PmsAttrAttrgroupRelationMapper;
/**
 * @author lyh
 * @version 1.0
 * @since 2021/4/6
 */
@Service
public class PmsAttrAttrgroupRelationService extends ServiceImpl<PmsAttrAttrgroupRelationMapper, PmsAttrAttrgroupRelation> {

	public void saveBatch(List<AttrRelationVo> vos) {
		List<PmsAttrAttrgroupRelation> collect = vos.stream().map(itemEvent -> {
			PmsAttrAttrgroupRelation attrgroupRelation = new PmsAttrAttrgroupRelation();
			BeanUtils.copyProperties(itemEvent, attrgroupRelation);
			return attrgroupRelation;
		}).collect(Collectors.toList());
		this.saveBatch(collect);
	}
}
